<?php
declare(strict_types=1);

namespace App\Models\Image;

use App\Models\BaseModel;

class Series extends BaseModel
{
    protected $table = "image_series";

    protected $fillable = [
        "id",
        "uid",
        "title",
        "url",
        "path",
        "is_show",
        "orders",
        "created_at",
        "updated_at",
        "navigate",
        "bg_color",
    ];

    protected $casts = [
        "uid" => "string"
    ];

    protected $appends = [
        "cover"
    ];

    public function getCoverAttribute():string
    {
        if (!empty($this->getAttribute("url")) && !empty($this->getAttribute("path"))) {
            return  $this->getAttribute("url") . $this->getAttribute("path");
        }
        return "";
    }
}
